public class Interface {
	public String aString211;
	public Sprite aSprite_212;
	public int[] anIntArray213;
	private static Archive aArchive_214;
	public int anInt215;
	private static Interface[] anIComponentArray216;
	public boolean aBoolean217;
	public int anInt218;
	public boolean aBoolean219;
	public byte aByte220;
	public int[] anIntArray221;
	public int anInt222;
	private static Font[] aFontArray223;
	public int[] anIntArray224;
	public int anInt225;
	public int anInt226;
	public int anInt227;
	public int anInt228;
	public boolean aBoolean229;
	public String aString230;
	public int anInt231;
	public int[] anIntArray232;
	public boolean aBoolean233;
	public int[][] anIntArrayArray234;
	public int anInt235;
	public int anInt236;
	public Font aFont_237;
	public int anInt238;
	public boolean aBoolean239;
	public int anInt240;
	public int anInt241;
	public int anInt242;
	private static int anInt243;
	public int anInt244;
	public Sprite aSprite_245;
	public static int anInt246 = -1;
	public boolean aBoolean247;
	public int anInt248;
	public String aString249;
	private static Cache aCache_250;
	public int anInt251;
	public int anInt252;
	public int anInt253;
	public int anInt254;
	public static int anInt255 = -1;
	public int[] anIntArray256;
	private static boolean aBoolean257;
	public int[] anIntArray258;
	public int anInt259;
	public int anInt260;
	public int anInt261;
	public String[] aStringArray262;
	public int anInt263;
	static Cache spriteCache = new Cache(30);
	public Sprite[] aSpriteArray265;
	public int anInt266;
	public int anInt267;
	public String aString268;
	public int[] anIntArray269;
	private int anInt270 = -68;
	private boolean aBoolean271 = true;
	public boolean aBoolean272;
	public int[] anIntArray273;
	public boolean aBoolean274;
	public int[] anIntArray276;
	public static int anInt277 = -1;
	private static boolean aBoolean278 = true;
	private static int anInt280;
	public String aString281;
	private static byte[][] aByteArrayArray282;
	public int anInt283;
	public int anInt284;
	public int anInt285;
	public int anInt286;
	public int anInt287;
	public boolean aBoolean288;
	public int anInt289;

	private static Sprite method194(int i, String string) {
		long l = (TextUtil.method301(183, string) << 8) + i;
		Sprite sprite = (Sprite) Interface.aCache_250
			.method345(l);
		if (sprite != null) {
			return sprite;
		}
		if (Interface.aArchive_214 == null) {
			return null;
		}
		try {
			sprite = new Sprite(Interface.aArchive_214, string, i);
			Interface.aCache_250.method346(sprite, l);
		} catch (Exception exception) {
			return null;
		}
		return sprite;
	}

	public static Interface method195(int i) {
		if (Interface.anIComponentArray216[i] == null) {
			Packet packet = new Packet(Interface.aByteArrayArray282[i]);
			int i_1_ = packet.getUShort();
			Interface.anIComponentArray216[i] = Interface.method198(i_1_, packet, 10896, i);
		}
		return Interface.anIComponentArray216[i];
	}

	public void method196(int i, int i_2_, int i_3_) {
		int i_4_ = anIntArray269[i_3_];
		anIntArray269[i_3_] = anIntArray269[i];
		anIntArray269[i] = i_4_;
		i_4_ = anIntArray224[i_3_];
		anIntArray224[i_3_] = anIntArray224[i];
		if (i_2_ < 0) {
			anIntArray224[i] = i_4_;
		}
	}

	private Model method197(int i, int i_5_) {
		ItemDefinition itemDefinition = null;
		if (i == 4) {
			itemDefinition = ItemDefinition.method212(i_5_);
			Interface.anInt280 += itemDefinition.anInt354;
			Interface.anInt243 += itemDefinition.anInt358;
		}
		Model model = ((Model) Interface.spriteCache
			.method345(((i << 16) + i_5_)));
		if (model != null) {
			return model;
		}
		if (i == 1) {
			model = Model.method588(i_5_);
		}
		if (i == 2) {
			model = NpcDefinition.method375(i_5_).method370(858);
		}
		if (i == 3) {
			model = Client.myPlayer.method581(true);
		}
		if (i == 4) {
			model = itemDefinition.method217(anInt270, 50);
		}
		if (i == 5) {
			model = null;
		}
		if (model != null) {
			Interface.spriteCache.method346(model, ((i << 16) + i_5_));
		}
		return model;
	}

	public static Interface method198(int i, Packet packet, int i_6_, int i_7_) {
		Interface iComponent = new Interface();
		iComponent.anInt215 = i_7_;
		iComponent.anInt248 = i;
		iComponent.anInt236 = packet.getUByte();
		iComponent.anInt289 = packet.getUByte();
		iComponent.anInt242 = packet.getUShort();
		iComponent.anInt241 = packet.getUShort();
		iComponent.anInt238 = packet.getUShort();
		if (i_6_ != 10896) {
			Interface.aBoolean278 = !Interface.aBoolean278;
		}
		iComponent.aByte220 = (byte) packet.getUByte();
		iComponent.anInt254 = packet.getUByte();
		if (iComponent.anInt254 != 0) {
			iComponent.anInt254 = (iComponent.anInt254 - 1 << 8) + packet.getUByte();
		} else {
			iComponent.anInt254 = -1;
		}
		if (iComponent.anInt242 == 600) {
			Interface.anInt246 = i;
		}
		if (iComponent.anInt242 == 650) {
			Interface.anInt255 = i;
		}
		if (iComponent.anInt242 == 655) {
			Interface.anInt277 = i;
		}
		int i_8_ = packet.getUByte();
		if (i_8_ > 0) {
			iComponent.anIntArray273 = new int[i_8_];
			iComponent.anIntArray256 = new int[i_8_];
			for (int i_9_ = 0; i_9_ < i_8_; i_9_++) {
				iComponent.anIntArray273[i_9_] = packet.getUByte();
				iComponent.anIntArray256[i_9_] = packet.getUShort();
			}
		}
		int i_10_ = packet.getUByte();
		if (i_10_ > 0) {
			iComponent.anIntArrayArray234 = new int[i_10_][];
			for (int i_11_ = 0; i_11_ < i_10_; i_11_++) {
				int i_12_ = packet.getUShort();
				iComponent.anIntArrayArray234[i_11_] = new int[i_12_];
				for (int i_13_ = 0; i_13_ < i_12_; i_13_++) {
					iComponent.anIntArrayArray234[i_11_][i_13_] = packet.getUShort();
				}
			}
		}
		if (iComponent.anInt236 == 0) {
			iComponent.anInt285 = packet.getUShort();
			iComponent.aBoolean219 = packet.getUByte() == 1;
			int i_14_ = packet.getUShort();
			iComponent.anIntArray258 = new int[i_14_];
			iComponent.anIntArray232 = new int[i_14_];
			iComponent.anIntArray276 = new int[i_14_];
			for (int i_15_ = 0; i_15_ < i_14_; i_15_++) {
				iComponent.anIntArray258[i_15_] = packet.getUShort();
				iComponent.anIntArray232[i_15_] = packet.getShort();
				iComponent.anIntArray276[i_15_] = packet.getShort();
			}
		}
		if (iComponent.anInt236 == 1) {
			iComponent.anInt225 = packet.getUShort();
			iComponent.aBoolean233 = packet.getUByte() == 1;
		}
		if (iComponent.anInt236 == 2) {
			iComponent.anIntArray269 = new int[iComponent.anInt241 * iComponent.anInt238];
			iComponent.anIntArray224 = new int[iComponent.anInt241 * iComponent.anInt238];
			iComponent.aBoolean274 = packet.getUByte() == 1;
			iComponent.aBoolean229 = packet.getUByte() == 1;
			iComponent.aBoolean288 = packet.getUByte() == 1;
			iComponent.aBoolean217 = packet.getUByte() == 1;
			iComponent.anInt263 = packet.getUByte();
			iComponent.anInt244 = packet.getUByte();
			iComponent.anIntArray221 = new int[20];
			iComponent.anIntArray213 = new int[20];
			iComponent.aSpriteArray265 = new Sprite[20];
			for (int i_16_ = 0; i_16_ < 20; i_16_++) {
				int i_17_ = packet.getUByte();
				if (i_17_ == 1) {
					iComponent.anIntArray221[i_16_] = packet.getShort();
					iComponent.anIntArray213[i_16_] = packet.getShort();
					String string = packet.getString();
					if (string.length() > 0) {
						int i_18_ = string.lastIndexOf(",");
						iComponent.aSpriteArray265[i_16_] = (Interface.method194(
							Integer.parseInt(string.substring(i_18_ + 1)),
							string.substring(0, i_18_)));
					}
				}
			}
			iComponent.aStringArray262 = new String[5];
			for (int i_19_ = 0; i_19_ < 5; i_19_++) {
				iComponent.aStringArray262[i_19_] = packet.getString();
				if (iComponent.aStringArray262[i_19_].length() == 0) {
					iComponent.aStringArray262[i_19_] = null;
				}
			}
		}
		if (iComponent.anInt236 == 3) {
			iComponent.aBoolean239 = packet.getUByte() == 1;
		}
		if (iComponent.anInt236 == 4 || iComponent.anInt236 == 1) {
			iComponent.aBoolean272 = packet.getUByte() == 1;
			int i_20_ = packet.getUByte();
			if (Interface.aFontArray223 != null) {
				iComponent.aFont_237 = Interface.aFontArray223[i_20_];
			}
			iComponent.aBoolean247 = packet.getUByte() == 1;
		}
		if (iComponent.anInt236 == 4) {
			iComponent.aString230 = packet.getString();
			iComponent.aString249 = packet.getString();
		}
		if (iComponent.anInt236 == 1 || iComponent.anInt236 == 3 || iComponent.anInt236 == 4) {
			iComponent.anInt240 = packet.getInt();
		}
		if (iComponent.anInt236 == 3 || iComponent.anInt236 == 4) {
			iComponent.anInt260 = packet.getInt();
			iComponent.anInt261 = packet.getInt();
			iComponent.anInt226 = packet.getInt();
		}
		if (iComponent.anInt236 == 5) {
			String string = packet.getString();
			if (string.length() > 0) {
				int i_21_ = string.lastIndexOf(",");
				iComponent.aSprite_212 = Interface.method194(
					Integer.parseInt(string.substring(i_21_ + 1)), string.substring(0, i_21_));
			}
			string = packet.getString();
			if (string.length() > 0) {
				int i_22_ = string.lastIndexOf(",");
				iComponent.aSprite_245 = Interface.method194(
					Integer.parseInt(string.substring(i_22_ + 1)), string.substring(0, i_22_));
			}
		}
		if (iComponent.anInt236 == 6) {
			i_7_ = packet.getUByte();
			if (i_7_ != 0) {
				iComponent.anInt283 = 1;
				iComponent.anInt284 = (i_7_ - 1 << 8) + packet.getUByte();
			}
			i_7_ = packet.getUByte();
			if (i_7_ != 0) {
				iComponent.anInt266 = 1;
				iComponent.anInt267 = (i_7_ - 1 << 8) + packet.getUByte();
			}
			i_7_ = packet.getUByte();
			if (i_7_ != 0) {
				iComponent.anInt286 = (i_7_ - 1 << 8) + packet.getUByte();
			} else {
				iComponent.anInt286 = -1;
			}
			i_7_ = packet.getUByte();
			if (i_7_ != 0) {
				iComponent.anInt287 = (i_7_ - 1 << 8) + packet.getUByte();
			} else {
				iComponent.anInt287 = -1;
			}
			iComponent.anInt251 = packet.getUShort();
			iComponent.anInt252 = packet.getUShort();
			iComponent.anInt253 = packet.getUShort();
		}
		if (iComponent.anInt236 == 7) {
			iComponent.anIntArray269 = new int[iComponent.anInt241 * iComponent.anInt238];
			iComponent.anIntArray224 = new int[iComponent.anInt241 * iComponent.anInt238];
			iComponent.aBoolean272 = packet.getUByte() == 1;
			int i_23_ = packet.getUByte();
			if (Interface.aFontArray223 != null) {
				iComponent.aFont_237 = Interface.aFontArray223[i_23_];
			}
			iComponent.aBoolean247 = packet.getUByte() == 1;
			iComponent.anInt240 = packet.getInt();
			iComponent.anInt263 = packet.getShort();
			iComponent.anInt244 = packet.getShort();
			iComponent.aBoolean229 = packet.getUByte() == 1;
			iComponent.aStringArray262 = new String[5];
			for (int i_24_ = 0; i_24_ < 5; i_24_++) {
				iComponent.aStringArray262[i_24_] = packet.getString();
				if (iComponent.aStringArray262[i_24_].length() == 0) {
					iComponent.aStringArray262[i_24_] = null;
				}
			}
		}
		if (iComponent.anInt236 == 8) {
			iComponent.aString230 = packet.getString();
		}
		if (iComponent.anInt289 == 2 || iComponent.anInt236 == 2) {
			iComponent.aString281 = packet.getString();
			iComponent.aString211 = packet.getString();
			iComponent.anInt222 = packet.getUShort();
		}
		if (iComponent.anInt289 == 1 || iComponent.anInt289 == 4 || iComponent.anInt289 == 5
			|| iComponent.anInt289 == 6) {
			iComponent.aString268 = packet.getString();
			if (iComponent.aString268.length() == 0) {
				if (iComponent.anInt289 == 1) {
					iComponent.aString268 = "Ok";
				}
				if (iComponent.anInt289 == 4) {
					iComponent.aString268 = "Select";
				}
				if (iComponent.anInt289 == 5) {
					iComponent.aString268 = "Select";
				}
				if (iComponent.anInt289 == 6) {
					iComponent.aString268 = "Continue";
				}
			}
		}
		return iComponent;
	}

	public static void method199(Font[] class50_sub1_sub1_sub2s, Archive archive,
		Archive archive_25_) {
		Interface.aCache_250 = new Cache(50000);
		Interface.aArchive_214 = archive_25_;
		Interface.aFontArray223 = class50_sub1_sub1_sub2s;
		int i_26_ = -1;
		Packet packet = new Packet(archive.method154("data",
			null));
		int i_27_ = packet.getUShort();
		Interface.anIComponentArray216 = new Interface[i_27_];
		Interface.aByteArrayArray282 = new byte[i_27_][];
		while (packet.offset < packet.payload.length) {
			int i_28_ = packet.getUShort();
			if (i_28_ == 65535) {
				i_26_ = packet.getUShort();
				i_28_ = packet.getUShort();
			}
			int i_29_ = packet.offset;
			Interface iComponent = Interface.method198(i_26_, packet, 10896, i_28_);
			byte[] is = (Interface.aByteArrayArray282[iComponent.anInt215] = new byte[packet.offset
				- i_29_ + 2]);
			for (int i_30_ = i_29_; i_30_ < packet.offset; i_30_++) {
				is[i_30_ - i_29_ + 2] = packet.payload[i_30_];
			}
			is[0] = (byte) (i_26_ >> 8);
			is[1] = (byte) i_26_;
		}
		Interface.aArchive_214 = null;
	}

	public static void method200(boolean bool, int i) {
		if (!bool) {
			Interface.aBoolean257 = !Interface.aBoolean257;
		}
		if (i != -1) {
			for (int i_31_ = 0; i_31_ < Interface.anIComponentArray216.length; i_31_++) {
				if (Interface.anIComponentArray216[i_31_] != null
					&& Interface.anIComponentArray216[i_31_].anInt248 == i
					&& Interface.anIComponentArray216[i_31_].anInt236 != 2) {
					Interface.anIComponentArray216[i_31_] = null;
				}
			}
		}
	}

	public static void method201(int i, Model model, int i_32_,
		int i_33_) {
		Interface.spriteCache.method347();
		if (i_33_ != 6) {
			for (int i_34_ = 1; i_34_ > 0; i_34_++) {
				/* empty */
			}
		}
		if (model != null && i != 4) {
			Interface.spriteCache.method346(model, ((i << 16) + i_32_));
		}
	}

	public static void method202(boolean bool) {
		Interface.anIComponentArray216 = null;
		Interface.aArchive_214 = null;
		if (bool) {
			Interface.aBoolean257 = !Interface.aBoolean257;
		}
		Interface.aCache_250 = null;
		Interface.aFontArray223 = null;
		Interface.aByteArrayArray282 = null;
	}

	public Model method203(int i, int i_35_, int i_36_, boolean bool) {
		Interface.anInt280 = 64;
		Interface.anInt243 = 768;
		Model model;
		if (bool) {
			model = method197(anInt266, anInt267);
		} else {
			model = method197(anInt283, anInt284);
		}
		if (model == null) {
			return null;
		}
		if (i == -1 && i_35_ == -1 && model.anIntArray1662 == null) {
			return model;
		}
		Model model_37_ = new Model(false,
			false, true, model,
			(Class21.method239(i) & Class21.method239(i_35_)));
		if (i_36_ != 0) {
			aBoolean271 = !aBoolean271;
		}
		if (i != -1 || i_35_ != -1) {
			model_37_.method595(7);
		}
		if (i != -1) {
			model_37_.method596(i, (byte) 6);
		}
		if (i_35_ != -1) {
			model_37_.method596(i_35_, (byte) 6);
		}
		model_37_.preProcess(Interface.anInt280, Interface.anInt243, -50, -10, -50,
			true);
		return model_37_;
	}
}
